﻿package mortal.game.view.common.tooltip.tooltips
{
    import Message.DB.Tables.*;
    import com.gengine.global.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.display.*;
    import com.mui.utils.*;
    import extend.language.*;
    import flash.display.*;
    import flash.text.*;
    import flash.utils.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.common.text.*;
    import mortal.game.cache.*;
    import mortal.game.cache.packCache.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.common.tooltip.*;
    import mortal.game.view.common.tooltip.tooltips.base.*;
    import mortal.game.view.common.util.*;
    import mortal.game.view.shopMall.view.*;

    public class ToolTipRune extends ToolTipScaleBg implements IToolTipComparableWithUpDownArrow
    {
        private var _txtName:GTextFiled;
        private var _icon:ShopSellItem;
        private var _bmpEquiped:Bitmap;
        private var _lockIcon:GBitmap;
        private var _txtBind:GTextFiled;
        private var _bmpZDL:GBitmap;
        private var _bmpFight:BitmapNumberText;
        private var _bmpUpDown:GBitmap;
        private var _txtSuitType:GTextFiled;
        private var _txtLevel:GTextFiled;
        private var _txtCareer:GTextFiled;
        private var _line1:ScaleBitmap;
        private var _line2:ScaleBitmap;
        private var _line3:ScaleBitmap;
        private var _txtBasicLabel:GTextFiled;
        private var _txtBasicAttr:AutoLayoutTextContainer;
        private var _txtOutputLabel:GTextFiled;
        private var _txtOutputAttr:AutoLayoutTextContainer;
        private var _txtRareLabel:GTextFiled;
        private var _txtRareAttr:AutoLayoutTextContainer;
        private var _combit:TRuneCombination;
        private var _txtTips:GTextFiled;
        private var _data:ItemData;
        private var _info:ItemInfo;
        private var _equipedData:ItemData;
        private var _useItemExInfo:ItemExInfo;

        public function ToolTipRune()
        {
            this.createChildren();
            paddingBottom = 8;
            paddingLeft = 12;
            paddingRight = 8;
            paddingTop = 8;
            return;
        }// end function

        public function setEquipedData(param1:Object) : void
        {
            this._equipedData = param1 as ItemData;
            return;
        }// end function

        public function set equiped(param1:Boolean) : void
        {
            if (param1)
            {
                if (this._bmpEquiped == null)
                {
                    this._bmpEquiped = UIFactory.bitmap(ImagesConst.EquipedLabel, -10, 18);
                }
                contentContainer2D.addChild(this._bmpEquiped);
            }
            else
            {
                DisplayUtil.removeMe(this._bmpEquiped);
            }
            return;
        }// end function

        override public function set data(param1) : void
        {
            this._data = param1 as ItemData;
            if (this._data == null)
            {
                return;
            }
            super.data = this._data;
            this._info = this._data.itemInfo;
            setBg(ToolTipUtil.getBgNameByColor(this._info.color));
            this.updateRuneAttrs();
            this.updateTopPart();
            this.updateLayout();
            _scaleBg.setSize(252, paddingTop + paddingBottom + this._txtTips.y + 20);
            this.updateName();
            return;
        }// end function

        private function updateRuneAttrs() : void
        {
            var _loc_1:int = 0;
            var _loc_2:Array = null;
            var _loc_3:String = null;
            var _loc_4:int = 0;
            var _loc_5:String = null;
            var _loc_6:Array = null;
            var _loc_7:Array = null;
            var _loc_8:GTextFiled = null;
            this.resetAutoTexts();
            this._combit = SkillConfig.instance.getRuneCombit(this._data.itemInfo.effect);
            if (this._combit == null)
            {
                if (Global.isDebugModle)
                {
                    Alert.show("在符文表t_rune_combination.json找不到id=" + this._data.itemCode);
                }
                return;
            }
            if (this._data.serverData == null || this._data.extInfo == null || this._data.extInfo.extObj == null || this._data.serverData.jsStr == null || this._data.serverData.jsStr.length == 0)
            {
                this._txtBasicLabel.textColor = 16751921;
                this._txtBasicLabel.text = Language.getString(20832);
                _loc_2 = this.getBasicAttrDescPre();
                _loc_2.sort(Array.DESCENDING);
                this.setAttrs(_loc_2, this._txtBasicAttr);
                this._txtOutputLabel.textColor = 16751921;
                _loc_3 = this.getRoundStr(this._combit.skillHurtRandNum);
                _loc_5 = Language.getString(20833);
                _loc_4 = this.getAttrNum("skillHurtRune");
                if (_loc_3 == "")
                {
                    _loc_5 = "";
                }
                else if (_loc_3.length > 1)
                {
                    _loc_5 = _loc_5 + Language.getStringByParam(20834, _loc_3);
                }
                else if (_loc_3.length == 1 && parseInt(_loc_3) != _loc_4)
                {
                    _loc_5 = _loc_5 + Language.getStringByParam(20835, _loc_3);
                }
                this._txtOutputLabel.htmlText = _loc_5;
                _loc_2 = this.getOuputAndRareDescPre("skillHurtRune");
                _loc_2.sort(Array.DESCENDING);
                this.setAttrs(_loc_2, this._txtOutputAttr);
                _loc_3 = this.getRoundStr(this._combit.skillEffectRandNum);
                _loc_5 = Language.getString(20836);
                this._txtRareLabel.textColor = 16751921;
                _loc_4 = this.getAttrNum("skillEffectRune");
                if (_loc_3 == "")
                {
                    _loc_5 = "";
                }
                else if (_loc_3.length > 1)
                {
                    _loc_5 = _loc_5 + Language.getStringByParam(20834, _loc_3);
                }
                else if (_loc_3.length == 1 && parseInt(_loc_3) != _loc_4)
                {
                    _loc_5 = _loc_5 + Language.getStringByParam(20835, _loc_3);
                }
                this._txtRareLabel.htmlText = _loc_5;
                _loc_2 = this.getOuputAndRareDescPre("skillEffectRune");
                _loc_2.sort(Array.DESCENDING);
                this.setAttrs(_loc_2, this._txtRareAttr);
            }
            else
            {
                this._txtBasicLabel.textColor = 16751921;
                this._txtBasicLabel.text = Language.getString(20837);
                this._txtOutputLabel.textColor = 16751921;
                this._txtOutputLabel.text = Language.getString(20838);
                this._txtRareLabel.textColor = 16751921;
                this._txtRareLabel.text = Language.getString(20836);
                _loc_6 = this.parseAfterAttrDescs(this._data.extInfo.extObj);
                _loc_7 = _loc_6[0];
                if (_loc_7 != null)
                {
                    _loc_7.sort(Array.DESCENDING);
                }
                _loc_1 = 0;
                while (_loc_7 != null && _loc_1 < _loc_7.length)
                {
                    
                    _loc_8 = this._txtBasicAttr.addNewText(220, " ", 12, 12122111);
                    _loc_8.htmlText = _loc_7[_loc_1] as String;
                    _loc_1++;
                }
                if (this._txtBasicAttr.getTextByIndex(0) == null)
                {
                    this._txtBasicLabel.text = "";
                }
                _loc_7 = _loc_6[1];
                if (_loc_7 != null)
                {
                    _loc_7.sort(Array.DESCENDING);
                }
                _loc_1 = 0;
                while (_loc_7 != null && _loc_1 < _loc_7.length)
                {
                    
                    _loc_8 = this._txtOutputAttr.addNewText(220, " ", 12, 11924735);
                    _loc_8.htmlText = _loc_7[_loc_1] as String;
                    _loc_1++;
                }
                if (this._txtOutputAttr.getTextByIndex(0) == null)
                {
                    this._txtOutputLabel.text = "";
                }
                _loc_7 = _loc_6[2];
                if (_loc_7 != null)
                {
                    _loc_7.sort(Array.DESCENDING);
                }
                _loc_1 = 0;
                while (_loc_7 != null && _loc_1 < _loc_7.length)
                {
                    
                    _loc_8 = this._txtRareAttr.addNewText(220, " ", 12, 11924735);
                    _loc_8.htmlText = _loc_7[_loc_1] as String;
                    _loc_1++;
                }
                if (this._txtRareAttr.getTextByIndex(0) == null)
                {
                    this._txtRareLabel.text = "";
                }
            }
            return;
        }// end function

        private function getAttrNum(param1:String) : int
        {
            var _loc_2:int = 0;
            var _loc_3:int = 1;
            while (_loc_3 < 10)
            {
                
                if (!this._combit.hasOwnProperty(param1 + _loc_3) || this._combit[param1 + _loc_3] == null)
                {
                    break;
                }
                _loc_3++;
                _loc_2++;
            }
            return _loc_2;
        }// end function

        override public function get width() : Number
        {
            return 252;
        }// end function

        private function updateLayout() : void
        {
            var _loc_1:int = 115;
            this._line1.visible = false;
            this._line2.visible = false;
            this._line3.visible = false;
            if (this._txtBasicLabel.text != "")
            {
                this._txtBasicLabel.y = _loc_1;
                _loc_1 = _loc_1 + 22;
                this._txtBasicAttr.y = _loc_1;
                _loc_1 = _loc_1 + (this._txtBasicAttr.height + 4);
                this._line1.y = _loc_1;
                _loc_1 = _loc_1 + 6;
                this._line1.visible = true;
            }
            if (this._txtOutputLabel.text != "")
            {
                this._txtOutputLabel.y = _loc_1;
                _loc_1 = _loc_1 + 22;
                this._txtOutputAttr.y = _loc_1;
                _loc_1 = _loc_1 + (this._txtOutputAttr.height + 4);
                this._line2.y = _loc_1;
                _loc_1 = _loc_1 + 6;
                this._line2.visible = true;
            }
            if (this._txtRareLabel.text != "")
            {
                this._txtRareLabel.y = _loc_1;
                _loc_1 = _loc_1 + 22;
                this._txtRareAttr.y = _loc_1;
                _loc_1 = _loc_1 + (this._txtRareAttr.height + 4);
                this._line3.y = _loc_1;
                _loc_1 = _loc_1 + 8;
                this._line3.visible = true;
            }
            this._txtTips.y = _loc_1;
            return;
        }// end function

        private function updateTopPart() : void
        {
            var _loc_1:* = ItemsUtil.isBind(this._data);
            this._icon.itemData = this._data;
            this._icon.isBind = _loc_1;
            this._lockIcon.visible = _loc_1;
            if (_loc_1)
            {
                this._txtBind.textColor = GlobalStyle.colorHongUint;
                this._txtBind.text = Language.getString(20206);
                this._txtBind.x = 100;
            }
            else
            {
                this._txtBind.textColor = GlobalStyle.colorLvUint;
                this._txtBind.text = Language.getString(20205);
                this._txtBind.x = 79;
            }
            var _loc_2:* = RuneCache.calcRunesCombat(this._data);
            if (_loc_2 == 0)
            {
                this._bmpFight.text = "???";
            }
            else
            {
                this._bmpFight.text = RuneCache.calcRunesCombat(this._data).toString();
            }
            this._bmpUpDown.x = this._bmpFight.x + this._bmpFight.width + 8;
            this._bmpUpDown.visible = false;
            this._txtLevel.text = Language.getString(30011) + "：" + this._info.level.toString();
            this._txtCareer.text = GameDefConfig.instance.getCarrer(this._info.career);
            if (CareerUtil.isCareerSuit(this._info.career, Cache.instance.role.entityInfo.career))
            {
                this._txtCareer.textColor = 15911263;
            }
            else
            {
                this._txtCareer.textColor = 16711680;
            }
            return;
        }// end function

        public function getMyCombat() : int
        {
            return parseInt(this._bmpFight.text);
        }// end function

        public function updateCombatUpDown(param1:int) : void
        {
            var _loc_2:* = parseInt(this._bmpFight.text);
            this._bmpUpDown.visible = true;
            if (_loc_2 == 0)
            {
                this._bmpUpDown.visible = false;
                return;
            }
            if (_loc_2 > param1)
            {
                this._bmpUpDown.bitmapData = GlobalClass.getBitmapData(ImagesConst.ToolTipUpArrow);
            }
            else if (_loc_2 == param1)
            {
                this._bmpUpDown.visible = false;
            }
            else
            {
                this._bmpUpDown.bitmapData = GlobalClass.getBitmapData(ImagesConst.ToolTipDownArrow);
            }
            return;
        }// end function

        private function updateName() : void
        {
            this._txtName.width = _scaleBg.width;
            var _loc_1:* = ItemsUtil.getItemWholeName(this._data, true, 0, false);
            _loc_1 = _loc_1.substring((_loc_1.indexOf("]") + 1));
            if (this._bmpFight.text == "???")
            {
                _loc_1 = Language.getString(20840) + _loc_1;
            }
            else
            {
                _loc_1 = Language.getString(20841) + _loc_1;
            }
            this._txtName.htmlText = _loc_1;
            this._txtName.x = -6;
            return;
        }// end function

        private function createChildren() : void
        {
            var _loc_1:* = GlobalStyle.textFormatPutong;
            _loc_1.align = TextFormatAlign.CENTER;
            _loc_1.size = 14;
            _loc_1.bold = true;
            this._txtName = UIFactory.gTextField("", -6, 0, 220, 25, this, _loc_1);
            this._icon = UICompomentPool.getUICompoment(ShopSellItem);
            this._icon.x = 0;
            this._icon.y = 26;
            this._icon.setItemStyle(ItemStyleConst.Big, ImagesConst.ShopItemBg, 6, 6);
            this._icon.createDisposedChildren();
            this.addChild(this._icon);
            this._icon.isShowLock = false;
            this._icon.isShowArroundEffect = false;
            _loc_1 = GlobalStyle.embedNumberTf;
            _loc_1.color = GlobalStyle.colorHuangUint;
            _loc_1.align = TextFormatAlign.RIGHT;
            this._lockIcon = UIFactory.bitmap(ImagesConst.LockIcon, 81, 34, contentContainer2D);
            this._txtBind = UIFactory.gTextField("", 100, 30, 100, 20, contentContainer2D);
            this._bmpZDL = UIFactory.gBitmap(ImagesConst.ToolTipCombat, 79, 78, contentContainer2D);
            this._bmpFight = UIFactory.bitmapNumberText(127, 78, "EquipToolTipCombat.png", 14, 16, -2, contentContainer2D, 10);
            this._bmpFight.customCharIndex = {0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, ?:10};
            this._bmpUpDown = UIFactory.gBitmap(null, 0, 78, contentContainer2D);
            this._txtSuitType = UIFactory.gTextField(Language.getString(20842), 155, 30, 100, 20, contentContainer2D);
            this._txtLevel = UIFactory.gTextField("", 155, 52, 100, 20, contentContainer2D);
            this._txtCareer = UIFactory.gTextField("", 79, 52, 100, 20, contentContainer2D);
            this._txtCareer.textColor = 15911263;
            this._txtBasicLabel = UIFactory.gTextField("", 0, 112, 240, 22, contentContainer2D);
            this._txtBasicAttr = new AutoLayoutTextContainer();
            this._txtBasicAttr.x = 16;
            this._txtBasicAttr.y = this._txtBasicLabel.y + 23;
            this._txtBasicAttr.verticalGap = -4;
            contentContainer2D.addChild(this._txtBasicAttr);
            this._line1 = UIFactory.bg(-20, 160, 250, 2, contentContainer2D, ImagesConst.SplitLine);
            this._txtOutputLabel = UIFactory.gTextField("", 0, 127, 240, 22, contentContainer2D);
            this._txtOutputAttr = new AutoLayoutTextContainer();
            this._txtOutputAttr.x = 16;
            this._txtOutputAttr.y = this._txtOutputLabel.y + 25;
            this._txtOutputAttr.verticalGap = -4;
            contentContainer2D.addChild(this._txtOutputAttr);
            this._line2 = UIFactory.bg(-20, 160, 250, 2, contentContainer2D, ImagesConst.SplitLine);
            this._txtRareLabel = UIFactory.gTextField("", 0, 127, 240, 22, contentContainer2D);
            this._txtRareAttr = new AutoLayoutTextContainer();
            this._txtRareAttr.x = 16;
            this._txtRareAttr.y = this._txtBasicLabel.y + 25;
            this._txtRareAttr.verticalGap = -4;
            contentContainer2D.addChild(this._txtRareAttr);
            this._line3 = UIFactory.bg(-20, 160, 250, 2, contentContainer2D, ImagesConst.SplitLine);
            this._txtTips = UIFactory.gTextField(Language.getString(20248), 0, 408, 242, 20, contentContainer2D);
            this._txtTips.textColor = 3602685;
            return;
        }// end function

        private function resetAutoTexts() : void
        {
            this._txtBasicAttr.split(0);
            this._txtOutputAttr.split(0);
            this._txtRareAttr.split(0);
            return;
        }// end function

        private function setAttrs(param1:Array, param2:AutoLayoutTextContainer) : void
        {
            var _loc_3:int = 0;
            var _loc_4:GTextFiled = null;
            if (param1 == null || param1.length == 0)
            {
            }
            else
            {
                _loc_3 = 0;
                while (_loc_3 < param1.length)
                {
                    
                    _loc_4 = param2.addNewText(220, " ", 12, 11661311);
                    _loc_4.htmlText = param1[_loc_3] as String;
                    _loc_3++;
                }
            }
            return;
        }// end function

        private function getRoundStr(param1:String) : String
        {
            var _loc_6:int = 0;
            if (param1 == null || param1.length < 2)
            {
                return "";
            }
            var _loc_2:* = param1.split("#");
            var _loc_3:* = int.MAX_VALUE;
            var _loc_4:int = -100000;
            var _loc_5:int = 1;
            while (_loc_5 < _loc_2.length)
            {
                
                _loc_6 = parseInt(_loc_2[_loc_5] as String);
                _loc_3 = Math.min(_loc_3, _loc_6);
                _loc_4 = Math.max(_loc_4, _loc_6);
                _loc_5++;
            }
            if (_loc_3 == _loc_4)
            {
                return _loc_4.toString();
            }
            return _loc_3 + "-" + _loc_4;
        }// end function

        private function getOuputAndRareDescPre(param1:String) : Array
        {
            var _loc_4:String = null;
            var _loc_5:Array = null;
            var _loc_6:String = null;
            var _loc_2:Array = [];
            var _loc_3:int = 1;
            while (_loc_3 < 10)
            {
                
                if (!this._combit.hasOwnProperty(param1 + _loc_3))
                {
                    break;
                }
                _loc_4 = this._combit[param1 + _loc_3];
                if (_loc_4 == null || _loc_4.length < 2)
                {
                    break;
                }
                _loc_5 = _loc_4.split("&");
                _loc_6 = this.getForSkillDescPre(_loc_5);
                if (_loc_6 != null && _loc_6.length > 0)
                {
                    _loc_2.push(_loc_6);
                }
                _loc_3++;
            }
            return _loc_2;
        }// end function

        private function getForSkillDescPre(param1:Array) : String
        {
            var _loc_2:String = null;
            var _loc_3:String = null;
            var _loc_4:String = null;
            var _loc_5:String = null;
            var _loc_8:String = null;
            var _loc_9:Array = null;
            var _loc_10:int = 0;
            var _loc_11:TRune = null;
            var _loc_12:Number = NaN;
            var _loc_6:Number = 10000000;
            var _loc_7:Number = 0;
            for each (_loc_8 in param1)
            {
                
                if (_loc_8 == null || _loc_8.length < 2)
                {
                    continue;
                }
                _loc_9 = _loc_8.split("#");
                _loc_10 = parseInt(_loc_9[1]);
                _loc_11 = SkillConfig.instance.getRune(_loc_10);
                if (_loc_11 == null)
                {
                    continue;
                }
                _loc_9 = this.splitAllNumbers(_loc_11.description);
                _loc_12 = parseFloat(_loc_9[1]);
                if (_loc_2 == null)
                {
                    _loc_2 = _loc_9[0];
                }
                if (_loc_4 == null)
                {
                    _loc_4 = _loc_9[2];
                }
                _loc_6 = Math.min(_loc_12, _loc_6);
                _loc_7 = Math.max(_loc_12, _loc_7);
            }
            if (_loc_6 == _loc_7)
            {
                _loc_3 = _loc_7.toString();
            }
            else
            {
                _loc_3 = _loc_6 + "-" + _loc_7;
            }
            return _loc_2 + "<font color=\'#00ff00\'>" + _loc_3 + "</font>" + _loc_4;
        }// end function

        private function splitAllNumbers(param1:String) : Array
        {
            var _loc_4:String = null;
            var _loc_5:int = 0;
            var _loc_2:Array = [];
            var _loc_3:int = 0;
            while (_loc_3 < param1.length)
            {
                
                _loc_4 = param1.charAt(_loc_3);
                if (_loc_4 >= "0" && _loc_4 <= "9")
                {
                    _loc_5 = _loc_3 + 1;
                    while (_loc_5 < param1.length)
                    {
                        
                        _loc_4 = param1.charAt(_loc_5);
                        if ((_loc_4 < "0" || _loc_4 > "9") && _loc_4 != ".")
                        {
                            break;
                        }
                        _loc_5++;
                    }
                    _loc_2.push(param1.substr(0, _loc_3));
                    _loc_2.push(param1.substr(_loc_3, _loc_5 - _loc_3));
                    _loc_2.push(param1.substring(_loc_5));
                    break;
                }
                _loc_3++;
            }
            return _loc_2;
        }// end function

        private function getBasicAttrDescPre() : Array
        {
            var _loc_3:String = null;
            var _loc_4:Array = null;
            var _loc_5:String = null;
            var _loc_6:Number = NaN;
            var _loc_7:Number = NaN;
            var _loc_8:String = null;
            var _loc_9:Array = null;
            var _loc_10:int = 0;
            var _loc_11:TRune = null;
            var _loc_12:Number = NaN;
            var _loc_13:Number = NaN;
            var _loc_1:Array = [];
            var _loc_2:int = 1;
            while (_loc_2 < 10)
            {
                
                if (!this._combit.hasOwnProperty("attriRune" + _loc_2))
                {
                    break;
                }
                _loc_3 = this._combit["attriRune" + _loc_2];
                if (_loc_3 == null || _loc_3.length < 2)
                {
                    break;
                }
                _loc_4 = _loc_3.split("&");
                _loc_6 = 1000000;
                _loc_7 = 0;
                for each (_loc_8 in _loc_4)
                {
                    
                    if (_loc_8 == null || _loc_8.length < 2)
                    {
                        continue;
                    }
                    _loc_9 = _loc_8.split("#");
                    _loc_10 = parseInt(_loc_9[1]);
                    _loc_11 = SkillConfig.instance.getRune(_loc_10);
                    if (_loc_11 == null)
                    {
                        continue;
                    }
                    _loc_5 = EquipmentUtil.getRuneEffectNameByEffectField(_loc_11.effectField);
                    _loc_9 = _loc_11.effectValue.split("#");
                    _loc_12 = parseFloat(_loc_9[1]);
                    _loc_13 = parseFloat(_loc_9[2]);
                    _loc_6 = Math.min(_loc_12, _loc_6);
                    _loc_6 = Math.min(_loc_13, _loc_6);
                    _loc_7 = Math.max(_loc_12, _loc_7);
                    _loc_7 = Math.max(_loc_13, _loc_7);
                }
                if (_loc_5 != null)
                {
                    if (_loc_6 != _loc_7)
                    {
                        _loc_1.push(_loc_5 + "：" + _loc_6 + "-" + _loc_7);
                    }
                    else
                    {
                        _loc_1.push(_loc_5 + "：" + _loc_6);
                    }
                }
                _loc_2++;
            }
            return _loc_1;
        }// end function

        private function getAttrDesc(param1:String) : Array
        {
            var _loc_5:String = null;
            var _loc_6:Array = null;
            var _loc_7:String = null;
            if (param1 == null || param1.length == 0)
            {
                return null;
            }
            var _loc_2:Array = [];
            var _loc_3:* = param1.split("&");
            var _loc_4:int = 0;
            while (_loc_4 < _loc_3.length)
            {
                
                _loc_5 = _loc_3[_loc_4];
                if (_loc_5 == null || _loc_5.length < 2)
                {
                }
                else
                {
                    _loc_6 = _loc_5.split("#");
                    _loc_7 = Language.getStringByParam(20843, int(int(_loc_6[0]) / 100), _loc_6[1]);
                    _loc_2.push(_loc_7);
                }
                _loc_4++;
            }
            return _loc_2;
        }// end function

        private function parseAfterAttrDescs(param1:Object) : Array
        {
            var _loc_4:* = undefined;
            var _loc_5:int = 0;
            var _loc_6:TRune = null;
            var _loc_7:Array = null;
            var _loc_8:int = 0;
            var _loc_2:Array = [];
            var _loc_3:* = new Dictionary();
            for (_loc_4 in param1)
            {
                
                if (!(_loc_4 is String) || (_loc_4 as String).indexOf("ru_") != 0)
                {
                    continue;
                }
                _loc_5 = parseInt((_loc_4 as String).substr(3));
                _loc_6 = SkillConfig.instance.getRune(_loc_5);
                if (_loc_6 == null)
                {
                    MsgManager.showRollTipsMsg(Language.getStringByParam(20844, _loc_5));
                    continue;
                }
                if (_loc_6.group != 0 && _loc_3.hasOwnProperty(_loc_6.group))
                {
                    continue;
                }
                _loc_3[_loc_6.group] = true;
                _loc_7 = _loc_2[_loc_6.posType];
                if (_loc_7 == null)
                {
                    _loc_7 = [];
                    _loc_2[_loc_6.posType] = _loc_7;
                }
                _loc_8 = param1[_loc_4];
                _loc_7.push(_loc_6.description.replace("{}", "<font color=\'#00ff00\'>" + _loc_8.toString() + "</font>"));
            }
            return _loc_2;
        }// end function

        public function setBuyback(param1:int) : void
        {
            var _loc_2:String = null;
            var _loc_3:Boolean = false;
            if (this._data.serverData.uid)
            {
                if (param1 < 0)
                {
                    this._txtTips.text = Language.getString(20248);
                    this._txtTips.textColor = 3602685;
                }
                else
                {
                    _loc_2 = GameDefConfig.instance.getEPrictUnitName(this._data.itemInfo.sellUnit);
                    _loc_3 = Cache.instance.role.enoughMoney(this._data.itemInfo.sellUnit, param1);
                    if (!_loc_3)
                    {
                        this._txtTips.textColor = 16711680;
                    }
                    else
                    {
                        this._txtTips.textColor = 65280;
                    }
                    this._txtTips.text = Language.getStringByParam(20260, param1.toString() + _loc_2);
                }
            }
            else
            {
                this._txtTips.text = "";
            }
            return;
        }// end function

    }
}
